// const webpack = require('webpack')
const { merge } = require('webpack-merge')
const commonConfig = require('./webpack.common')
const path = require('path')

const webpackConfig = merge(commonConfig, {
  mode: 'development',
  devtool: 'source-map',
  output: {
    path: path.join(__dirname, 'dist'),
    publicPath: '/',
    filename: 'js/[name].bundle.js',
    chunkFilename: 'js/[id].chunk.js'
  },
  devServer: {
    hot: true, // 开启 HMR
    contentBase: ['./public', './dist', '/'], // 静态资源路径
    overlay: true,
    port: 8081,
    open: true
  }
})

module.exports = webpackConfig
